package com.aibton.controller;

import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.aibton.dao.datacenter.SysUserMapper;
import com.aibton.dao.test.UserMapper;
import com.aibton.entity.datacenter.SysUser;
import com.aibton.entity.test.User;
import com.aibton.service.InsertService;

/**
 * Created by huzhihui on 2017/7/13.
 */
@RestController
@RequestMapping(value = "test")

public class InsertController {

    @Autowired
    private InsertService insertService;

    @Autowired
    private SysUserMapper sysUserMapper;
    @Autowired
    private UserMapper    userMapper;

    @RequestMapping(value = "insert")
    @Transactional
    public String insert() {
        SysUser sysUser = new SysUser();
        sysUser.setSysUserId(UUID.randomUUID().toString());
        User user = new User();
        user.setSysUserId(UUID.randomUUID().toString());

        sysUserMapper.insert(sysUser);
        int a = 1 / 0;
        userMapper.insert(user);
        return "OK";
    }
}
